package com.ccp.dev.system.service.impl.curuser;

import com.ccp.dev.core.basic.model.CurrentUser;
import com.ccp.dev.system.model.UserRole;
import com.ccp.dev.system.service.ICurUserService;
import com.ccp.dev.system.service.UserRoleService;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

public class RoleUserService implements ICurUserService {

    @Resource
    UserRoleService userRoleService;

    @Override
    public List<String> getByCurUser(CurrentUser currentUser) {
        List<UserRole> list= userRoleService.getByUserId(currentUser.getUserId());
        List<String> roleList=new ArrayList<String>();
        for(UserRole userRole:list){
            roleList.add(userRole.getRoleId());
        }
        return roleList;
    }

    @Override
    public String getKey() {
        return "role";
    }

    @Override
    public String getTitle() {
        return "角色授权";
    }
}
